package com.myprocessing.gui;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.myprocessing.controller.GuiController;

import processing.core.PApplet;

public class PGuiFrameApp extends PGuiFrameApplet {

	protected static String myClassName = getQualifiedClassName();

	protected static Logger logger = Logger.getLogger(myClassName);
	
	static public void main(String _args[]) {
		if(_args.length > 0){
			myClassName = _args[0];
		}
		logger.error(myClassName);
		PApplet.main(new String[] { myClassName });
	}

	public static String getQualifiedClassName() {
		return new Exception().getStackTrace()[1].getClassName();
	}
	
	public void setup() {
		uiCtx = new FileSystemXmlApplicationContext("config/gui.xml");
        controller = (GuiController)uiCtx.getBean("controller");

        GuiController.init(this, uiCtx);
        
		size(controller.getScreenManager().getSize().getX(), controller.getScreenManager().getSize().getY());
        
        smooth();
	}
	
//	public void setup() {}
//	
//	public void draw(){};
	
}
